Skip to content

Adds v2 test lab triggers #1241

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 30, 2022
Merged

Adds v2 test lab triggers #1241

merged 5 commits into from
Sep 30, 2022

Conversation

colerogers
Copy link
Contributor

@colerogers colerogers commented Sep 22, 2022

This change adds test lab triggers to the v2 codebase and sneaks in some remote config changes. For remote config, we update the tsdoc strings for reference docs and remove @Alpha tags since the public docs have been published.

Test Lab functions:

import {
  onTestMatrixCompleted,
  TestMatrixCompletedData
} from "firebase-functions/v2/testLab";

// passing in a handler only
export const fn1 = onTestMatrixCompleted((event) => { ... });

// declaring options
export const fn2 = onTestMatrixCompleted(
  { region: "us-central1", retry: true },
  (event) => {  ...  }
);

@colerogers colerogers marked this pull request as ready for review September 27, 2022 17:26
handler?: (event: CloudEvent<TestMatrixCompletedData>) => any | Promise<any>
): CloudFunction<CloudEvent<TestMatrixCompletedData>> {
if (typeof optsOrHandler === "function") {
handler = optsOrHandler as (event: CloudEvent<TestMatrixCompletedData>) => any | Promise<any>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance we can change this to not be any | Promise ? (same with others)

Copy link
Contributor Author

@colerogers colerogers Sep 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a better recommendation?

We might be able to get away with void | Promise, but I'd argue it's better to be consistent with the other v2 event providers that all use any | Promise. For example remote config, storage, crashlytics, etc.

Also, we'd probably have to have a followup api review since this has already been approved by council

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess my main question was along the lines of if we could avoid the any.

But if theres prior art, and would require api review again... I'm alright leave it as-is.

@TheIronDev
Copy link
Contributor

I love all the thoroough documentation!!!

@colerogers colerogers merged commit ed62824 into launch.next Sep 30, 2022
@taeold taeold added this to the v4 milestone Oct 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants